#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

const int N = 200000;
int n, val[N], tot, vis[N], last[N];

char s[155][75];
char str[1000010];
int trie[N][26], fail[N];

void insert(char *str, int id) {
	int n = strlen(str), cur = 0;
	for (int i = 0; i < n; ++i) {
		int ch = str[i] - 'a';
		if (!trie[cur][ch]) trie[cur][ch] = ++tot;
		cur = trie[cur][ch];
	}
	val[cur] = id;
}

void query(char *str) {
	int res = 0, cur = 0, m = strlen(str);
	for (int i = 0; i < m; ++i) {
		int ch = str[i] - 'a';
		cur = trie[cur][ch];
		if (val[cur]) vis[val[cur]]++;
		int v = last[cur];
		while (v) {
			if (val[v]) vis[val[v]]++;
			v = last[v];
		}
	}
	for (int i = 1; i <= n; ++i) { res = max(res, vis[i]); }
	printf("%d\n", res);
	for (int i = 1; i <= n; ++i) {
		if (vis[i] == res) printf("%s\n", s[i]);
	}
}

void getfail() {
	queue< int > q;
	for (int i = 0; i < 26; ++i) {
		if (trie[0][i]) { q.push(trie[0][i]); }
	}
	while (!q.empty()) {
		int x = q.front();
		int v = 0;
		q.pop();
		for (register int i = 0; i < 26; ++i) {
			v = trie[x][i];
			if (v) {
				q.push(v);
				fail[v] = trie[fail[x]][i];
				last[v] = val[fail[v]] ? fail[v] : last[fail[v]];
			} else
				trie[x][i] = trie[fail[x]][i];
		}
	}
}

void init() {
	memset(vis, 0, sizeof(vis));
	memset(val, 0, sizeof(val));
	memset(last, 0, sizeof(last));
	memset(trie, 0, sizeof(trie));
	memset(fail, 0, sizeof(fail));
	tot = 0;
}

int main() {

#ifndef ONLINE_JUDGE
#ifdef DEBUG
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef DEBUG
	freopen("ACAutoMachine(Strong).in", "r", stdin);
	freopen("ACAutoMachine(Strong).out", "w", stdout);
#endif
#endif

	while (scanf("%d", &n) == 1 && n) {
		for (int i = 1; i <= n; i++) {
			scanf("%s", s[i]);
			insert(s[i], i);
		}
		getfail();
		scanf("%s", str);
		query(str);
		init();
	}
	return 0;
}